<h2>E-mails enregistrés</h2>

<div>
	<?= button_add('admin/emails/create', 'Nouveau message') ?>
</div>
<table class="dataTable">
	<thead>
		<tr>
			<th>Sujet</th>
			<th>Envoyé le</th>
			<th>Créé le</th>
			<th>Créé par</th>
			<th>Actions</th>
		</tr>
	</thead>
	<tbody>
		<?php foreach ($emails as $email) { ?>
			<tr id="email_<?= $email->id ?>">
				<td><?= $email->subject ?></td>
				<td><?= time_to_str($email->sent_at) ?></td>
				<td><?= time_to_str($email->created_at) ?></td>
				<td><?= $email->creator_firstname ?> <?= $email->creator_name ?></td>
				<td class="actions">
					<?= details_link($email, 'email_details') ?>
					<?= edit_link($email, 'emails/edit') ?>
					<?= delete_link($email, 'email_delete') ?>
				</td>
			</tr>
		<?php } ?>
	</tbody>
</table>

